<?php

use App\Http\Middleware\CheckBannedMiddleware;
use App\Http\Middleware\CheckIpMiddleware;
use App\Http\Middleware\SignatureMiddleware;
use App\Http\Middleware\TokenMiddleware;
use App\Http\Middleware\UserInfoMiddleware;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Middleware;

$app = Application::configure(basePath: dirname(__DIR__))->withRouting(
    web: __DIR__ . '/../routes/web.php',
    commands: __DIR__ . '/../routes/console.php',
    health: '/up',
)->withMiddleware(function (Middleware $middleware) {
    $middleware->alias([
        'token' => TokenMiddleware::class,
        'signature' => SignatureMiddleware::class,
        'userinfo' => UserInfoMiddleware::class,
        'checkBanned' => CheckBannedMiddleware::class,
        'checkIp' => CheckIpMiddleware::class,
    ]);
})->create();
$app->singleton(
    Illuminate\Contracts\Debug\ExceptionHandler::class,
    App\Exceptions\Handler::class
);
return $app;
